/**
 * @author 李亚松
 * @email  lysong01@gmail.com
 * 
 * DirectiryUtils.java 2012-11-27
 * description 
 */
package liyasong.util;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class DirectiryUtils {
	
	private static List<String> filePaths = new ArrayList<>();
	
	/*
	 * 此方法可以递归得到当前目录下的所有文件路径
	 */
	public static List<String> getFilePaths(String dirName) {
		File dir = new File(dirName);
//		System.out.println(dir.getPath());
		if (dir.exists() && dir.isDirectory()) {
			for (File file : dir.listFiles()) {
				if (!file.isDirectory()) {
					filePaths.add(file.getPath());
				} else {
					getFilePaths(file.getPath());
				}
			}
			return filePaths;
		} else {
			System.out.println(dirName + " does not exist, or isn't a dir");
			return new ArrayList<String>();
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		for (String str : DirectiryUtils.getFilePaths("resources")) {
			System.out.println(str);
		}

	}

}
